package genedit.controller.interfaceActions;

import genedit.gui.GMainFrame;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.ImageIcon;
import javax.swing.KeyStroke;

/**
 * Akcija zadužena za štampanje sadržaja aktivnog dokumenta.
 * 
 * @author Milan
 * @version 1.0 5/1/14
 */
public class GPrintA extends AbstractAction {
	private static final long serialVersionUID = -2387179207597201113L;
	private static GPrintA instance = null;

	public static AbstractAction getInstance() {
		if (instance == null)
			instance = new GPrintA();
		return instance;
	}

	public GPrintA() {
		putValue(NAME, "Print");
		putValue(SMALL_ICON, new ImageIcon("resources/icons/printer.png"));
		putValue(MNEMONIC_KEY, KeyEvent.VK_P);
		putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_P, ActionEvent.CTRL_MASK));
		putValue(SHORT_DESCRIPTION, "Print");
	}

	/**
	 * Akcija poziva metodu za štampanje.
	 */
	public void actionPerformed(ActionEvent arg0) {
		GMainFrame.getInstance().print();
	}

}